<template>
  <slot v-if="showed"></slot>
</template>
<script setup>
import store from "@/store/store.js";
import {computed} from "vue";

const props = defineProps({
  permissions: Array
})
let showed = computed(() => {
  return hasPermission(store.state.user.permissionList)
})

function hasPermission(permissionList) {
  for (let permission of props.permissions) {
    if (permissionList.indexOf(permission) > -1) {
      return true
    }
  }
  return false
}

</script>
